<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>退货管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 订单中心
		<span class="c-gray en">&gt;</span>退货管理

		<a class="btn btn-success btn-refresh radius r mt-5 mr-20"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
	</nav>
	<div class="pd-20">

		<div class="cl pd-5 bg-1 bk-gray">
			<a id="one" href="<%=path%>/backstage/rgo-list" class="title rleft def">全部</a>
			<a id="two" href="<%=path%>/backstage/rgo-list?status=0" class="title def">待审核</a>
			<a id="three" href="<%=path%>/backstage/rgo-list?status=1" class="title rright def">已审核</a>
		</div>
		
		<div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/rgo-list" method="get" class="form form-horizontal" id="search-form">
			<div class="text-c"> 
				<div class="row cl">
					<input type="hidden" name="status" id="status" value="${status }"/>
					<label class="form-label col-1">订单号：</label>
					<div class="formControls col-2">
					<input type="text" name="title" value="${title}" id="title" placeholder="订单号" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">用户：</label>
					<div class="formControls col-2">
					<input type="text" name="mobile" value="${mobile}" id="title" placeholder="收货电话" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">申请时间：</label>
					<div class="formControls col-2">
						<input type="text"  name="stime" readonly="readonly"  onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')}'})"  value="${stime}"  id="datemin" class="input-text Wdate" >
					</div>
					<div class="formControls col-2">
						<input type="text" name="etime" readonly="readonly" value="${etime}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}'})" id="datemax" class="input-text Wdate" >
					</div>
	   			</div>
				
				<div class="row cl">
				<button name="" id="" class="btn btn-success f-r radius mr-20" type="submit"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
				<!-- <div style="width:10px;height:5px;float:right;"></div>
					<button name="" onclick="theReset();" id="" class="btn btn-success" style="border-radius:5px;float:right;" >
						 重置
					</button> -->
				</div>
			</div>
		</form>
		</div>
	
		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th>ID</th>
						<th>订单号</th>
						<th>用户</th>
						<!-- <th>提现后余额</th> -->
						<th>订单金额</th>
						<th>申请时间</th>
						<th>状态</th>
						<th width="120">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${rgo}" var="r">
						<tr class="text-c">
							<input type="hidden" id="cId" name="cId" value='${ca.id}' />
							<td>${r.id}</td>
							<td>
								<a style="text-decoration:none;color:#5a98de;" onclick="show('订单详情','<%=path%>/backstage/order-details?rid=${r.rid}');" href="javascript:;" title="${r.gid}">${r.gid}</a>
							</td>
							<td>${r.uid}</td>
							<%-- <td>${ca.after_money }</td> --%>
							<td>${r.paymoney}</td>
							<td><%-- ${fn:split(r.create_date,'.')[0]} --%>${r.create_date }</td>
							<td class="td-status">
								<c:choose>
									<c:when test="${0==r.return_status}">
										<span class="label label-warning radius">未审核</span>
									</c:when>
									<c:when test="${1==r.return_status}">
										<span class="label label-success radius">审核成功</span>
									</c:when>
									<c:when test="${2==r.return_status}">
										<span class="label label-danger radius">审核失败</span>
									</c:when>
								</c:choose></td>
							<td class="td-manage">
								<%-- <a style="text-decoration:none"
								onClick="shop_edit(this,'${shop.cId}')" href="javascript:;"
								title="编辑">编辑
								&nbsp;&nbsp; --%>
								<c:choose>
								<c:when test="${0==r.return_status}">
									<%-- <a style="text-decoration:none" onClick="rgo_enable(this,'${r.id}','${r.gid }')" href="javascript:;" title="审核">审核</a> --%>
									<a style="text-decoration:none"
										onClick="check_return('${r.id}','${r.gid }')" href="javascript:void(0);"
										title="审核">审核</a>
								</c:when>
								</c:choose>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<div id="Pagination" class="page-con"></div>
		</div>
		<input type="hidden" id="retid" />
		<input type="hidden" id="ordid" />
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			initPager();
			var status=$("#status").val();
			if(status=="two"){
				$("#two").addClass("blue1");
			}else if(status=="three"){
				$("#three").addClass("blue1");
			}else{
				$("#one").addClass("blue1");
			}
		});
		
		var showCount = ${pageInfo.showCount};
		var currentPage = ${pageInfo.currentPage-1};
		var totalResult = ${pageInfo.totalResult};
		function initPager(){
			$("#Pagination").pagination(totalResult, {
	            callback: function(new_page_index, pagination_container){
	            	var oldLocation = location.href;
	            	var pa = "currentPage=" + (new_page_index+1);
	        		var shoC = "showCount=" + showCount;
	            	var index = oldLocation.lastIndexOf("?");
	            	if (index == -1){
	            		location.href = oldLocation + "?" + pa + "&" + shoC;
	            	}else if (oldLocation.indexOf("currentPage") == -1){
	            		location.href = oldLocation + "&" + pa;
	            	}else if (oldLocation.indexOf("showCount") == -1){
	            		location.href = oldLocation + "&" + shoC;
	            	}else{
	            		var temp = oldLocation.replace(/currentPage=\d+/, pa);
						var newLocation = temp.replace(/showCount=\d+/, shoC);
	            		location.href = newLocation;
	            	}
	            	return false;
	            },
	            items_per_page:showCount, 
	            load_first_page:false,
	            prev_text:'上一页',
	            next_text:'下一页',
	            ellipse_text:'...',
	            num_edge_entries:1,
	            num_display_entries:5,
	            current_page:currentPage
	        });
		}
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});
		
		/*查看订单详情*/
		function show(title,url){
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		}
		/*审核*/
		function check_return(retid,ordid){
			/* $("#retid").val(retid);
			$("#ordid").val(ordid); */
			var edit_page = "<%=path%>/backstage/review_return_order?id="+retid;
			layer_show("审核",edit_page);
		}
		/*审核*/
		function rgo_enable(obj,id,orderid){
			layer.confirm('审核退货？', {
				btn: ['通过','不通过'], 
				shade: false,
				closeBtn : false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/rgo-review",
					data : {
						id:id,
						type:1,
						orderid:orderid
					},
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">审核成功</span>');
						$(obj).remove();
						layer.msg('已审核');
					}
				});
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/rgo-review",
					data : {
						id:id,
						type:2,
						orderid:orderid
					},
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						$(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">审核失败</span>');
						$(obj).remove();
						layer.msg('已审核');
					}
				});
			});
		}
	</script>
</body>
</html>